package org.yefei.homeworkday17.five;

public class Scan {
	private String brand;

//声呐扫描仪
	public void scan(Move m) {
		System.out.println(brand + "牌的声呐扫描仪启动扫描。。。");
		if (m instanceof Fish) {
			Fish f = (Fish) m;
			System.out.println("声呐扫描到一条名叫" + f.getName() + "的鲨鱼");
			f.move();
		} else if (m instanceof Dolphin) {
			Dolphin d = (Dolphin) m;
			System.out.println("声呐扫描到一条名叫" + d.getName() + "的海豚");
			d.move();
		} else if (m instanceof Submarine) {
			Submarine s = (Submarine) m;
			System.out.println("声呐扫描到一条名叫" + s.getName() + "的潜艇");
			s.move();
		}
	}

	public Scan(String brand) {
		this.brand = brand;
	}
}
